home *** CD-ROM | disk | FTP | other *** search
/ Power CD / Power CD ATARI-Rechner Lieben.iso / APPS / PD / EULER / PROGS / HUND.E < prev    next >
Encoding:
Text File  |  1991-11-11  |  796 b   |  37 lines

  1. .. Hundekurve
  2.  
  3. function mann(t)
  4. ##    return t|-ones(size(t));
  5.     return cos(t)|sin(t);
  6. endfunction
  7.  
  8. function dgl (t,y)
  9.     delta=mann(t)-y;
  10.     norm=sqrt(sum(delta*delta));
  11.     return delta/norm;
  12. endfunction
  13.  
  14. function hund (t)
  15. ## Berechnet die Hundkurve zur Zeit t.
  16. ## Der Hund startet in [0,0] und bewegt sich mit Geschwindigkeit 1.
  17. ## Der Mann bewegt sich wie mann(t).
  18.     return heun("dgl",t,[0,0]);
  19. endfunction
  20.  
  21. function show (endtime)
  22.     t=linspace(0,endtime,100);
  23.     y=heun("dgl",t,[0,0]);
  24.     m=mann(t')';
  25.     xplot(y[1]_m[1],y[2]_m[2]);
  26.     title("Hund und Mann");
  27.     wait(180);
  28.     xplot(y[1]-m[1],y[2]-m[2]);
  29.     title("Differenz");
  30.     wait(180);
  31.     n=length(y[1]); d=sqrt((y[1,n]-m[1,n])^2+(y[2,n]-m[2,n])^2);
  32.     "Letzter Abstand : ", d,
  33.     return plot();
  34. endfunction
  35.  
  36. " show(endtime) defined"
  37.